﻿<?php


$obj=new mysql($config);

$sql="select * from `author` where pid=0";
$date=$obj->getCondition($sql);

foreach ($date as $k => $v) {
	$sql="select * from `author` where `pid`=$v[id]";
	$date[$k]['ch']=$obj->getCondition($sql);
}
// print_r($date);

if(isset($_SERVER['HTTP_X_REQUESTED_WITH'])){
   echo json_encode($date);
   die;
}



if(!empty($_POST)){

    $_POST['author_id']=implode(',',$_POST['author_id']);
    $row=$obj->insert($_POST,'role');
    if($row){
        echo '<script>alert("添加成功");location.href="index.php?c=role&a=list&mod=admin";</script>';
    }else{
        echo '<script>alert("添加失败");location.href="index.php?c=role&a=list&mod=admin";</script>';
    }
}









require_once (VIEW_PATH.'admin/layout.html');

